<?php
/* @var $this ProductController */
$this->breadcrumbs=array(
	'Products'=>array('index'), 
);
//分类缓存
$categoryCache = Category::model()->GetCatCache();
?>
<!--正文start-->
<div class="w_960 o_a">
    <div class="col_sub w_190 f_l">
        <!--宝贝分类start-->
        <div class="pro_classify">
            <div class="hd bg"><h2 class="fs_14"><a class="c_white" href="javascript:">所有宝贝分类</a></h2></div>
            <div class="bd">
                <ul id="proSort">
                    <?php foreach($category as $key=>$val){?>    
                        <?php if($val['zca_visible']==1){?>                
                        <li class="item">
                            <h3 class="c_green3 bg_x click"><?php echo $val['zca_title'] ?></h3>
                            <div class="list">
                                <ul class="li">
                                <?php foreach( $val['subcat'] as $key=>$val ){?>
                                    <?php if($val['zca_visible']==1){?>  
                                        <li>
                                            <p class="h"><span class="ico ico_fold click2"></span><?php echo CHtml::link($val['zca_title'], array('/home/product/list', 'id' => $val['zca_id']), array('title' => $val['zca_title'],'class' => 'c_666 fw_b'))?><span class="c_999">（<?php echo $val['pro_count'] ?>）</span></p>
                                            <ul class="sub line_20">
                                              <?php  foreach( (array)$val['subcat'] as $key=>$val ){?>
                                                  <?php if($val['zca_visible']==1){?>  
                                                    <li><?php echo CHtml::link($val['zca_title'], array('/home/product/list', 'id' => $val['zca_id']), array('title' => $val['zca_title'],'class' => 'c_999'))?><span class="c_999">（<?php echo $val['pro_count'] ?>）</span></li>
                                                  <?php }?>
                                              <?php }?>
                                            </ul>
                                        </li>
                                    <?php }?>
                                <?php }?>
                                </ul>
                            </div>
                        </li>     
                        <?php }?>               
                    <?php }?>
                </ul>
            </div>
        </div>
        <!--宝贝分类end-->
        <!--热卖单品 start-->
        
        <!--热卖单品 end-->
        <div class="adv mt10"><a href="javascript:" title=""><img src="images/prolist_ad1.jpg" width="190" height="220" alt="" /></a></div>
        <div class="adv mt10"><a href="javascript:" title=""><img src="images/prolist_ad1.jpg" width="190" height="220" alt="" /></a></div>
    </div> 
	
	<div class="col_main w_760 f_r">
        <div class="position bg_x ff_s c_f">
            <span class="f_r">
                <strong class="c_orange"><?php echo $model->search()->getTotalItemCount(); ?></strong> 件相关商品
            </span>
            <span class="c_999">产品搜索：“<?php echo $_GET['keyword'];?>”</span></div>
        <div class="pro_list mt10">
            <div class="hd"><span class="bg fs_14 c_white fw_b">所有产品</span></div>   
            <?php   
                $this->widget('zii.widgets.CListView', array(  
                    'dataProvider'=>$model->search(20),  
                    'itemView'=>'_view',    
                    'emptyText'=>'暂时没有数据',  
                    'pager'=>array('class'=>'CLinksPager'),
					'cssFile'=>'/css/yii-list-view/styles_h.css',
                    'htmlOptions'=>array('class'=>'list-view pro_list bd'),
                    'itemsTagName'=>'ul',
                    'itemsOptions'=>array('class'=>'list c_f'),
                    'summaryText'=>'第 {start}-{end} 条, 共<strong class="c_red2">{count}</strong> 条   第{page}页/共{pages}页',
                    'pagerTemplate'=>'onlyPager',
                    'buttonCssClass'=>'bg_x btn_page',
                    'batchItemOptions'=>array('class'=>"f_l batchItem"),
                    'batchItem'=>array(  
                        //移动到分类  
                        '<span class="c_666">排序：</span>',  
                        //添加到分类  
                        CHtml::link('默认排序',array('search','keyword'=>$keyword,'sort'=>''),array('class'=>empty($model->list_order)?"default price":"default")),
                        CHtml::link(($model->list_order==4)?'价格<b class="ico ico_up"></b>':'价格<b class="ico ico_down"></b>',array('search','keyword'=>$keyword,'sort'=>($model->list_order==4)?6:4),array('class'=>($model->list_order==4||$model->list_order==6)?"bg_x price":"bg_x")),  
                        CHtml::link(($model->list_order==5)?'销量<b class="ico ico_up"></b>':'销量<b class="ico ico_down"></b>',array('search','keyword'=>$keyword,'sort'=>($model->list_order==2)?5:2),array('class'=>($model->list_order==2||$model->list_order==5)?"bg_x price":"bg_x")),
                        CHtml::link(($model->list_order==7)?'上架时间<b class="ico ico_up"></b>':'上架时间<b class="ico ico_down"></b>',array('search','keyword'=>$keyword,'sort'=>($model->list_order==1)?7:1),array('class'=>($model->list_order==1||$model->list_order==7)?"bg_x price":"bg_x")),
                     ),  
                    ));  
            ?>
        </div>
    </div>
</div>
<div class="hr_30"></div>
<!--热销产品推荐 start-->

<!--热销产品推荐 end-->
<!--正文end-->
<script>
$(function(){
    $("#proSort").Subsort();
    $("#proSort").Subsort2();
    $('.c_img50 img').LoadImage(true,50,50);
    $('.c_img160 img').LoadImage(true,160,160);
    $(".list_page li").mousedown(function(){
    $(".list_page li ").removeClass("cur");
    $(this).addClass("cur");
    });
});
</script>